package cn.walls1717.wallsmall.search.thread;

import lombok.extern.slf4j.Slf4j;

/**
 * 实现Runnable接口
 * 
 * 因为Java是单继承，多实现，继承了Tread类会导致类无法再继承其他类，灵活性降低
 * 
 * @author walls1717
 * @since 2022/11/08 20:10
 **/
@Slf4j
public class ThreadTest2 {

    public static void main(String[] args) {
        log.info("main -> start");
        Thread02 thread02 = new Thread02();
        new Thread(thread02).start();
        log.info("main -> end");
    }

    public static class Thread02 implements Runnable {
        @Override
        public void run() {
            log.info("当前线程id -> {}", Thread.currentThread().getId());
            int i = 10 / 2;
            log.info("运行结果 -> {}", i);
        }
    }
}
